<?php ob_start(); ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>' ?>
<?php require_once 'index.php';   ?>
<!DOCTYPE section PUBLIC "//COMPONENTS/" "components.dtd">
<component name="Promociones" type="table_dojo" search="id_promo;descripcion" target="promociones" js="promociones.js" edit="true" add="true" delete="true" list="true" edit_additional_validation="true" excel="true">
    <tab name="Par&amp;aacute;metros B&amp;aacute;sicos" target="promociones" add="true" edit="true" clone="true" >
        <element name="ID Original" target="id_promo" type="pk_original" visible="false" edit="false" add="false" clone="false"/>
        <element name="ID" target="id_promo" type="dojo_validation_textbox" required="true" visible="true" edit="readonly" add="true" clone="true"/>
        <element name="Recurrente" target="recurrencia" width="55" type="dojo_filtering_select" table="promociones_recurrencia" formatter="formatRecurrencia" onchange="validaRecurrencia(this.value);" visible="true" edit="readonly" add="readonly" clone="true"/>
        <element name="D&amp;iacute;as de Recurrencia" maxlength="4" target="limite_recurrencia" type="dojo_validation_textbox" reg_exp="[\d]+" invalid_message="Solo números" visible="false" edit="true" add="true" clone="true"/>
        <element name="D&amp;iacute;as de Vigencia" width="45" target="vigencia" type="dojo_validation_textbox" required="true" visible="true" edit="true" add="true" clone="true"/>
        <element name="Valor" target="costo" width="45" type="dojo_validation_textbox" required="true" onchange="activaAbono(this.value);" visible="true" edit="true" add="true" clone="true"/>                
        <element name="C&amp;oacute;digo de Tasaci&amp;oacute;n" target="cod_tasacion" type="dojo_validation_textbox" required="true" visible="true" edit="true" add="true" clone="true"/>
        <element name="C&amp;oacute;digo de Tasaci&amp;oacute;n Recurrencia" target="cod_tasacion_rec" type="dojo_validation_textbox" required="false" visible="false" edit="true" add="true" clone="true"/>
        <element name="Tipo de Cliente" target="tipo_cliente" type="dojo_filtering_select" table="promociones_tipocliente" formatter="formatTipoCliente" onchange="activaFormaCobro(this.value);"  visible="true" edit="true" add="true" clone="true"/>
        <element name="Forma de Cobro H&amp;iacute;brido" target="cobro_hib" type="dojo_filtering_select" table="promociones_formacobro" formatter="formatFormaCobroHibrido" visible="true" edit="true" add="true" clone="true"/>                
        <element name="Abono" target="abono" type="dojo_validation_textbox" required="false" visible="false" edit="true" add="true" clone="true"/>
        <element name="C&amp;oacute;digo de Servicio SCL" target="cod_servicio" type="dojo_validation_textbox" required="false" visible="false" edit="true" add="true" clone="true"/>
        <element name="Notifica a Plataforma Externa" target="notifica" type="dojo_checkbox" onchange="validaNotifica();" default_value="S" default_empty="N" required="false" visible="false" edit="true" add="true" clone="true"/>
        <element name="Env&amp;iacute;a SMS de Confirmaci&amp;oacute;n" target="envia_sms" type="dojo_checkbox" onchange="validaNotifica();" default_value="S" default_empty="N" required="false" visible="false" edit="true" add="true" clone="true"/>
        <element name="Concepto Facturable" target="envia_sms" type="dojo_validation_textbox"  visible="false" edit="true" add="true" clone="true"/>
        <element name="M&amp;aacute;x. de Compras" width="45" target="num_max_compra" type="dojo_validation_textbox" reg_exp="[\d]+" invalid_message="Solo números" visible="true" edit="true" add="true" clone="true"/>
        <element name="Descripci&amp;oacute;n" target="descripcion" type="dojo_validation_textbox" required="false" visible="false" edit="true" add="true" clone="true"/>                        
    </tab>
    <tab name="Bolsas" target="promociones" add="true" edit="true" clone="true">
        <element name="Bolsa \nSMS" width="45" target="bolsa_sms" formatter="formatBolsa" table="bolsas" table_method="select_sms" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>
        <element name="Bolsa \nMMS" width="45" target="bolsa_mms" formatter="formatBolsa" table="bolsas" table_method="select_mms" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>
        <element name="Bolsa \nMIN" width="45" target="bolsa_min" formatter="formatBolsa" table="bolsas" table_method="select_min" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>     
        <element name="Bolsa \nGPRS" width="45" target="bolsa_gprs" formatter="formatBolsa" table="bolsas" table_method="select_gprs" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>
        <element name="Bolsa \nSpinvox" width="45" target="bolsa_spinvox" formatter="formatBolsa" table="bolsas" table_method="select_spinvox" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>
        <element name="Bolsa \nMovitalk" width="45" target="bolsa_movitalk" formatter="formatBolsa" table="bolsas" table_method="select_movitalk" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>
        <element name="Bolsa \nNFMINS" width="45" target="bolsa_nfmins" formatter="formatBolsa" table="bolsas" table_method="select_nfmins" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>     
        <element name="Bolsa \nNFDIAS" width="45" target="bolsa_nfdias" formatter="formatBolsa" table="bolsas" table_method="select_nfdias" table_pk="id_bolsa" table_field="id_bolsa" default_value="" default_text="Seleccione..." type="dojo_filtering_select" visible="true" edit="true" add="true" clone="true"/>                                
    </tab>
    <tab name="Usuarios Canal de Compra" target="promociones" add="true" edit="true" clone="true">
<?php 
/** [TODO] implementar tags for-each para evitar usar php con xml
 */
$model = new UsuariosSistemaModel();
$select = $model->select();
$usuarios = $model->fetchAll($select);
   
foreach ($usuarios as $i => $v) {   
?>  <element name="<?php echo $v->usuario ?>" target="promousuario_<?php echo $v->usuario ?>" type="dojo_checkbox" visible="false" edit="true" add="true" clone="true"/>
<?php 
}
?>        
    </tab>
    <tab name="Mensajes" target="promociones" add="true" edit="true" clone="true">
        <element name="Mensaje de &amp;eacute;xito" maxlength="160" target="txt_exito" required="true" type="dojo_validation_textarea"  invalid_message="Ingrese mensaje, sin saltos de línea" visible="false" edit="true" add="true" clone="true"/>
        <element name="Mensaje de error" maxlength="160" target="txt_error" required="true" type="dojo_validation_textarea" invalid_message="Ingrese mensaje, sin saltos de línea"  visible="false" edit="true" add="true" clone="true"/>
        <element name="Mensaje sin saldo" maxlength="160" target="txt_sin_saldo" required="true" type="dojo_validation_textarea" invalid_message="Ingrese mensaje, sin saltos de línea"  visible="false" edit="true" add="true" clone="true"/>
    </tab>
</component>